package identify;

import java.util.ArrayList;
import java.util.List;

public class HeroList {

	/**
	 * 获得所有英雄
	 * @return
	 */
	public List<Hero> findAllHero(){
		
		List<Hero> list = new ArrayList<Hero>();
		
		list.add(new AA());
		list.add(new AM());
		list.add(new BM());
		list.add(new CM());
		
		return list;
	}
	
	/***
	 * 获得可以选择的英雄
	 * @param list
	 * @return
	 */
	public List<Hero> findCanSelect(List<Hero> list){
		
		List<Hero> temp = new ArrayList<Hero>();
		
		for(Hero hero : list){
			if(hero instanceof Ban){
				temp.add(hero);
			}
		}
		
		for(Hero hero : temp){
			list.remove(hero);
		}
		
		return list;
	}
	
	public static void main(String[] args) {
		
		HeroList heroList = new HeroList();
		List<Hero> list = heroList.findAllHero();
		System.out.println("所有英雄："+list);
		System.out.println("可选择："+heroList.findCanSelect(list));
	}
	
	
}
